Storage device counting error correction

ABSTRACT

A semiconductor storage device that determines the cause of an error at the time of the error correction of data read out from a non-volatile semiconductor memory, on the basis of a previously recorded error correction count, and selects a data refresh processing or a substitute processing to perform. When the error is detected, the corrected data is rewritten back for preventing reoccurrence of error due to accidental cause. If it is determined that the reoccurrence frequency of the error is high and the error is due to degradation of the storage medium, based on the error correction count, the substitute processing is performed.

This application claims a priority based on Japanese patent Application11-263156 filed on Sep. 17, 1999, the entire contents of which areincorporated herein by reference for all purposes.

BACKGROUND OF THE INVENTION

The present invention relates to a storage device having a semiconductormemory as a storage medium, particularly to a storage device using anerror correction code for improving reliability of stored data.

Rapid increase in kinds and amounts of information data with thedevelopment of information processing equipment has brought a remarkabledevelopment of storing devices. For accelerating expansion of storagecapacity, efforts have been directed to technological developments forincreasing storage densities of storage media. Nevertheless, when datais stored in a temporary storage medium, namely in a rewritable storagemedium, the security of the stored data is not always assured becausephase change of magnetic material or storage of electrical charges isutilized. The reliability of stored data is generally lowered as thestorage density is increased.

In a storage device with a flash memory, for example, electrical chargesstored in a storage element sometimes gradually leaks out to causedestruction of data. Therefore, almost all storage devices of such akind are provided with data protection functions using error correctioncodes. In an external storage device used for a personal computer, anerror correction code, which is similar to the one used in a magneticdisk drive and calculated using 512 byte data, are stored together withdata. When read out, the stored data are checked for errors, the errorsare corrected if errors are detected, and then stored data are outputtedwith the security thereof being increased.

In the above conventional magnetic storage device, no problem is causedby stochastically occurred errors, namely, errors that do not reoccur inthe same location. However, in the storage device, no consideration isgiven for errors fixed to a certain location due to accidents inherentto a storage medium such as fatigue, damage, foreign matter sticking,and wire breaking in the storage medium. If such kinds of errors occurwith negligibly small probabilities, there is no problem. However, suchkinds of errors will accumulate when they occur with probabilities thatare not negligible in the normal use. The error correction code isusually capable of correcting errors with a specified number of bits orin a specified area. However, if there occurs errors exceeding errorcorrection capability of the code, the error can not be detected (missdetection), or wrong identification of an error location or an errorpattern can be made to perform faulty correction of correct data (misscorrection). Therefore, even if data is corrected when being outputted,the incorrect data left uncorrected on the storage medium causes anothererror that accumulates to exceed the capability of the error correctioncode, which results in making it impossible to recover the stored data.Only with a measure for increasing reliability by merely using errorcorrection code, the foregoing problem will occur.

In addition, there can be another problem due to occurrences of twokinds of errors characteristic to the storage medium: an occurrence ofdata error due to degradation of the medium and that due to accidentalcauses. In a nonvolatile semiconductor memory, for example, degradationdue to repetition of a rewriting cycle deteriorates data maintaincharacteristics to cause data error. Meanwhile, electric signal noisesor radiation can cause stochastic data errors irrespective of thedegradation. In this case, by rereading the data, correct data can besometimes read, or by rewriting the data, correct data can be readthereafter. However, these two kinds of data errors can not bedistinguished from each other by observing the data which are theresults of the errors. In the case of the data error due to degradation,since it will accumulate in a area as described above, a substitute areamust be provided for storing data and the degraded area must be madeunusable without being left as it is to avoid accumulation of errors. Inthe case of the data error which is accidental and does not relate todegradation, since an area with such error can be brought normal stateby rewriting the data, providing a substitute area and making the errorarea unusable is to lower the efficiency of the storage device. However,no measure has been taken for such a problem as above.

SUMMARY OF THE INVENTION

It is an object of the present invention to increase security of thedata in a nonvolatile semiconductor storage device and to extend life ofthe nonvolatile semiconductor storage device by deciding whether theoccurred data error is of accident or of reoccurrence due to degradationand carrying out the suitable processing.

In a nonvolatile semiconductor storage device according to the presentinvention, first, when a data error is detected in reproducing data fromeach block of a storage medium, which block is a unit of data access,error correction is carried out with the error correction count recordedfor each area. Second, it is judged for each block whether the errorcorrection count reaches a predetermined value or not. If the errorcorrection count is less than the predetermined value, corrected data isrewritten in the same area. If the error correction count has reachedthe predetermined value, a substitute area is allocated to which thecorrected data is transferred with the previously used area madeunusable.

Moreover, with the degree of error correction divided into a pluralityof grades, rewriting the data or allotting a substitute area is selectedto be executed in accordance with the grade.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram showing a configuration of a storagedevice according to the present invention;

FIG. 2 is a schematic diagram showing an example of a managementinformation;

FIG. 3 is a flow chart showing a reading processing;

FIG. 4 is an example of a table for deciding whether a refreshingprocess is to be carried out or a substitute process is to be carriedout;

FIG. 5 is a schematic diagram showing a data flow in a refreshprocessing;

FIG. 6 is a flow chart showing an operation of the refresh processing;

FIG. 7 is a schematic diagram showing a data flow in a substituteprocessing; and

FIG. 8 is a flow chart showing the substitute processing.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

Embodiments of the present invention will be explained in the followingwith reference to drawings.

FIG. 1 is a schematic diagram showing a configuration of a semiconductorstorage device, in particular, of a nonvolatile semiconductor storagedevice. The storage device 101 according to the present invention shownin FIG. 1 is connected to a system bus 102 of a host computer that makesa request to the storage device 101 for data reading and writing. Arewritable nonvolatile memory 103, which is a storage medium of thestorage device 101 and can be in various forms such as a chip, module,and unit, includes a normal data storing area 104, a normal managementarea 105, a substitute data storing area 106, and a substitutemanagement area 107. The normal data storing area 104, which is anormally used area, is divided into a plurality of blocks, each of whichis a unit of data access. The divided block units of the normal datastoring area 104 are managed by the normal management area 105 thatstores management information of the normal data storing area. Thesubstitute data storing area 106 is divided into a plurality of blocks,each of which is allocated for being substituted for a faulty block inthe normal data storing area 104. The divided block units in thesubstituted data storing area 106 are managed by the substitutemanagement area 107, in which there is stored management information forthe substitute data storing area 106 (correspondence to the normal datastoring area 104, error detection and correction codes of thesubstituted data, etc). That is, in the data storage device according tothe present invention, the data storing areas are controlled in blocks,each of which is a unit of data access. The storage unit 101 furtherincludes a control unit 108 for carrying out control inside the storageunit 101, an error detection and correction circuit 109 for the datastored in the nonvolatile memory 103, and a buffer memory 110 thattemporarily stores data received from and transmitted to the system bus102.

Next, an operation of the storage device 101 will be explained. The hostcomputer requests the storage device 101 through the system bus 102 tostore data or to read out stored data. The control unit 108 identifies aphysical address in the nonvolatile memory 103 corresponding to alogical address indicated at the same time when the request is made bythe host computer, and carries out a processing in accordance with arequested access.

Since the data storage device 101 according to the present inventionexcellently exhibits its effect at reading of the stored data, the readoperation will be explained. When reading of a certain data isrequested, the control unit 108 identifies a corresponding physicaladdress of the requested data in the nonvolatile memory 103 and read outthe data in the area corresponding to the physical address in the normaldata storing area 104 and the management information in thecorresponding area in the normal management area 105. Both of the dataand management information being read out are inputted to the errordetection and correction circuit 109 to be subjected to error detection,and are also stored into the buffer memory 110.

FIG. 2 is a schematic diagram showing an example of contents ofmanagement information in the normal management area 105. A data areaerror detection and correction code (ECC) 201 for detecting andcorrecting an error or errors in a data area is obtained by inputtingstored data in the error detection and correction circuit 109. If theresult of the error detection indicates that error correction isrequired and possible, the error correction count 202 is recorded foreach divided block in the corresponding data storing area. A blockidentifier code 203 indicates a content of a block. With the blockidentifier code 203, there are identified several kinds of blocks suchas a usable block, unusable block, normal data block, substitute areablock, and empty block. In an area 204, a logical address 204 is storedwhich is assigned by the host computer when the block is allocated. Inan area 205, there is stored a management area error detection andcorrection code 205 for increasing the reliability of the managementinformation itself.

The management information shown in FIG. 2 is stored in each block inthe normal management area 105 and the substitute management area 107.All of the information are produced in the control unit 108 and storedinto the corresponding locations in the normal management area 105 orthe substitute management area 107. The control unit 108, on the basisof the information, identifies a physical storing location (physicaladdress) of a read data requested by the host computer and reads out acorresponding location in the normal data storing area 104 forresponding to the access request of the host computer.

When an error is detected in read out data in the read operation, aprocessing is carried out as explained below. The control unit 108inputs the data read out from a specified block in the nonvolatilememory 103 into the error detection and correction circuit 109 togetherwith the data area error detection and correction code 201 in themanagement information to detect presence or absence of an error in thedata. When the presence of an error is detected, it is meant that thereoccurs an error of some kind in the nonvolatile memory 103. Although theerror may be caused by a transmission error on some transmission line inthe device, here, the error is taken as being caused by a failure ofsome kind in the nonvolatile memory 103. Data with an error should bereused if the error is due to an accidental cause and the data can beused without problem by rewriting it with the error being corrected.While, however, an error caused by degradation is anticipated to reoccureven if the data is rewritten with the error being corrected. Therefore,in the embodiment, after correcting the error, the data is rewritten forthe present with an error correction count recorded to determine thecause of the error based on the error correction count.

An operation procedure in a read processing is shown in a flow chart inFIG. 3. The flow chart is shown to be started from a step at which aread access is requested from the host computer through the system bus102. The control unit 108 specifies a physical storage location to readdata and management information (STEP 301). At this time, the read outdata and the management information are inputted to the error detectionand correction circuit 109, by which it can be ascertained whether anerror has occurred or not (STEP 302). When no error has occurred in thedata at this time, the data can be provided to the host computer as isread out, therefore the read out data is outputted (STEP 310). While,when an error is detected, a decision is made as to whether the error iscorrectable or not on the basis of the processing result of the errordetection and correction circuit 109 (STEP 303). When there has occurredan uncorrectable error at this time, it is of no use to read out thedata. Thus, it is informed to the host computer that the data can not beread out (STEP 304). When there has occurred the correctable error, theerror correction is performed(STEP 305) with an increment of the errorcorrection count to update the management information (STEP 306).

Following this, the error correction count is compared with the errorcorrect maximum value(ECM) (STEP 307). When the error correction countis less than ECM, the data area is determined to be still usable, andthe corrected data is rewritten at the same location and the data areais continuously used (refresh processing, STEP 308). While, when theerror correction count becomes equal to or more than ECM, it isdetermined that the data area is not usable any more and substituteprocessing is carried out (STEP 309). Namely, an unused block isselected from the substitute data storing area 106 to be allocated as asubstitute area. At this time, it is necessary to prepare informationindicating the correspondence of the substitute area and the normal datastoring area 104 and to write the information in the correspondinglocation in the management information. On completion of the processingat STEP 308 or STEP 309, the corrected data is outputted to the hostcomputer to complete the read processing (STEP 310).

In the above embodiment, switching between the rewriting processing andthe substitute processing is carried out in accordance with the decisionas to whether the error correction count exceeds the predetermined count(ECM) or not. In addition, as shown in FIG. 4, together with the errorcorrection count, the error occurrence count in the data block can betaken as an additional factor in making such decision. There occurs notalways one error in each data block, but a plurality of errors can occurat a time. A high count of error occurrence indicates that the block hasa high possibility of being degraded or falling into a state in whichthe data correction is impossible. Therefore, such a block may be bettersubjected to the substitute processing in an earlier stage. The table inFIG. 4 indicates that when many errors occur, the substitute processingis carried out despite small error correction count. In this case, anerror occurrence count is also recorded in the error correction count202 shown in FIG. 2 together with the correction count. Along with this,at STEP 307 in FIG. 3, a decision is made on the basis of the tableshown in FIG. 4 as to whether the refresh processing or the substituteprocessing is to be carried out.

FIG. 5 is a schematic diagram illustrating a data flow in a datarewriting operation in the refresh processing, and FIG. 6 is a flowchart showing the data rewriting operation in the refresh processing. Anarea 501 is a stored data section of a certain block in the normal dataarea. An area 502 is for an error detection and correction code (ECC) ofthe stored data. An area 503 is for miscellaneous managementinformation, an example of which is shown in FIG. 2. An area 504 is abuffer memory for temporarily storing the read out stored data. The readout stored data 501 is inputted to the error detection and correctioncircuit 109 and at the same time, stored in the buffer memory 504 (STEP601).

At this time, the ECC 502 is also inputted to the error detection andcorrection circuit 109 to carry out the error detection. When any erroris detected, decision is made, on the basis of the number of errorsand/or the error correction count as shown in FIG. 4, as to whether thedata rewrite processing (refresh processing) is to be executed or not(STEP 602). When it is decided that no refresh processing is to beexecuted, other processing is carried out to complete the processing(STEP 603). While, when it is decided that the refresh processing is tobe executed, the error detection and correction circuit 109 is furtheroperated to identify the error location and the error pattern to executeerror correction on the buffer memory 110 (STEP 604). Next to this, anincrement of the error correction count is carried out (STEP 605) withthe stored data written back in the same location (STEP 606). Theforegoing operation is different from that in the previously explainedprocessing in the order of carrying out the processing. However, sincethere is no problem in obtaining a required effect, the order can bechanged as it fits.

FIG. 7 is a schematic diagram illustrating a data flow in the substituteprocessing in which an operation of data correction is the same as thatin the refresh processing illustrated in FIG. 5 with further operationcarried out thereafter for storing the corrected data in anotherselected block 701. At this time, since the stored data is not modified,the ECC 502 is to be the same. Therefore, the ECC 502 is written as itis as an ECC 702 when there occurs no error therein. While, when thereoccurs any error in the ECC 502, it is to be written as the ECC 702 withthe error corrected. In addition, miscellaneous information 503(management information other than ECC) is to be written with necessaryupdating.

An entire flow of the substitute processing is shown as a flow chart inFIG. 8. The substitute processing shown in FIG. 8 is executed at STEP309 in the flow chart shown in FIG. 3. At first, at STEP 801, there iscarried out a selection of a substitute block for the corrected data. Ofvarious possible ways of selecting the substitute block, that of usingblocks in order in an area specialized for substitution providedbeforehand (for example, the substitute data storing area 106 shown inFIG. 1) may be most easily managed with a short selection time. Otherpossible ways are such ones as selecting a block with smallerdegradation, and using a block predetermined so as to correspond to theblock to be substituted.

Following this, at STEP 802, updating of a management table is carriedout which becomes necessary by a change in the correspondence betweenthe logical address and physical address of the block due to thesubstitution. The management table is the one such as an addresstranslation table for translating a logical address (an addressspecified by the host computer in accessing) into a physical address ona memory. It is indispensable to a storage device that carries outsubstitution. The management table can be managed in various ways. Thepresent embodiments store the whole management table in a specifiedlocation (for example, the substitute management area 107 in FIG. 1) onthe nonvolatile memory for facilitating management and updating. Oncompletion of the updating, the data is transferred to the substituteblock and stored in the block at STEP 803. Since the corrected data isstored in the buffer memory, the stored corrected data is thentransferred to the substitute data storing area. The ECC data and themanagement information are processed as previously described. Thus, thesubstitute processing is completed.

According to the present invention, it is decided whether the substituteprocessing is to be executed or not by determining whether an erroroccurrence is due to accident or due to degradation that causes frequentoccurrence of the error. Therefore, the substitute processing can beexecuted less frequently to make it possible to reduce unnecessary useof the substitute area. Moreover, with the rewriting of the data, thecell status can be made more stable in the one where data error occurredas well as the one where the error is not occurred yet, so that the datacan be stored with increased reliability. Furthermore, in addition tothe error correction count, the error occurrence count also can be takenas an additional factor of the above decision to allow a practical andfine control.

While the present invention has been particularly shown and describedwith reference to preferred embodiments thereof, it will be understoodby those skilled in the art that the foregoing and other changes in formand details can be made therein without departing from the spirit andscope of the present invention.

What is claimed is:
 1. A storage device comprising: a semiconductormemory for storing data, the memory including a plurality of blocks;means for reading the data from each block of the memory; errordetection and correction means for detecting and correcting an error ofthe read data for each block; and means for rewriting data in an area inwhich error correction is carried out, back in the same read area whenan error is detected in the read data.
 2. A storage device comprising: asemiconductor memory for storing data, the memory including a pluralityof blocks; means for reading the data from each block of the memory;error detection and correction means for detecting and correcting anerror of the read data for each block; means for recording an errordetection count about the read data for each block; and means forcarrying out a comparison of a value of the error detection count with apredetermined value when an error is detected in the read data, and forrewriting data in an area in which error correction of the data iscarried out in the same area on the basis of a result of the comparison.3. A storage device comprising: a semiconductor memory for storing data,the memory including a plurality of blocks; means for reading the datafrom each block of the memory; error detection and correction means fordetecting and correcting an error of the read data for each block; meansfor recording an error detection count and an error occurrence countabout the read data for each block; and means for carrying outcomparisons of values of the error detection count and the erroroccurrence count with respective predetermined values when an error isdetected in the read data, and for rewriting data in an area in whicherror correction of the data is carried out, in one of the same area andanother area on the basis of results of the comparisons.
 4. A storagedevice comprising: a semiconductor memory for storing data, the memoryincluding a plurality of blocks; means for reading the data from eachblock of the memory; error detection and correction means for detectingand correcting an error of the read data for each block; means forrecording an error occurrence count about the read data for each block;and means for carrying out a comparison of a value of the erroroccurrence count with a predetermined value when an error is detected inthe read data, and for rewriting data in an area in which errorcorrection is carried out, in one of the same area and another area onthe basis of a result of the comparison.